package day22;
import java.util.Iterator;
import java.util.LinkedList;
public class learn3 {
    public static void main(String[] args) {
        //定义数组
        String[] strs ={"12345","67891","12347809933","98765432102","67891","12347809933"};
        //定义集合
        LinkedList <String>liskedList=new LinkedList<String>();
        //添加数据
        for(int i=0;i<strs.length;i++){
        liskedList.add(strs[i]);}
        //比较重复元素 和删除
        for(int i=0;i<liskedList.size();i++){
            for(int j=i+1;j<liskedList.size();j++){
                if(liskedList.get(i).equals(liskedList.get(j))){
                    liskedList.remove(j);
                }
            }
        }
        System.out.println(liskedList);
        System.out.println("以下操作是打印");
        //迭代器打印
       Iterator iterator = liskedList.iterator();
       while (iterator.hasNext()){
           System.out.println(iterator.next());
       }
   for( String  t:liskedList){
       System.out.println(t);
   }
}
}

